<?php


namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\MenuService;
use Illuminate\Http\Request;


class MenuController extends Controller
{

    /**
     * @api {post} api/menu/store 创建
     */
    public function store(Request $request, MenuService $service) {
        return $service->store($request->input(), true);
    }

    /**
     * @api {get} api/menu/info/{id} 信息
     */
    public function show(MenuService $service, $id = null) {
        return $service->show($id);
    }

    /**
     * @api {post} api/menu/update/{id} 更新
     */
    public function update(Request $request, MenuService $service, $id = null) {
        return $service->update($id, $request->input());
    }

    /**
     * @api {delete} api/menu/destroy/{id} 删除
     */
    public function destroy(MenuService $service, $id){
        return $service->destroy($id);
    }

    /**
     * @api {get} api/menu/paginate 分页
     */
    // public function index(Request $request, MenuService $service) {
    //     return $service->index($request->query());
    // }

    /**
     * @api {get} api/menu/lists 列表
     */
    public function lists(Request $request, MenuService $service) {
        return $service->lists($request->query());
    }
}
